The static string type, Data types


Description:

    Concept strings are autoallocable (you don't need to allocate them). It can hold up to 2GB of bytes (on the 32-bit platforms). A Concept will have (when possible) a zero at the end of it, for compatibility with general libraries, most of them written in C. It has its own length (an internally data field), so when you call the {length} operator no character count will be performed. There are some gadgets associated with string operators, like the [] operator. In C, normally you can say s[1]='x' when s is "abcd" resulting into "axbcd". This is true in Concept too, but you can also do this: s[1]="xyz" resulting into "axyzcd", so you can replace a character with another string. Also, in Concept you have two types of quotes the ' and the ". In most cases are identical, but there are some exceptions.

The " quotes can contain expressions preceded by the $.
For example:
    var name="Joe";
    var str="Hello $name";

Will result in a string that looks like this: "Hello Joe".

If the name variable is a member of an object, or requires an expression, you must use ${} to evaluate like this:

    var str="Hello ${this.name}" resulting in "Hello Joe".

Even if you use a member name from the current class (a non-local variable) the { } are mandatory. The { } are optional only when you put simple variables with NO operators.

Examples

    Expressions:             "one plus one is ${1+1}" results "one plus one is 2"
    Array elements        "element is ${arr[0]}"
    Array elements with keys    "element is ${arr['key']}" (notice the single quotes used)


When using the single quotes (') the expressions will NOT be evaluated, and will be taken as it is:

Example
    "one plus one is ${1+1}"    results "one plus one is 2"
    'one plus one is ${1+1}'    remains unchanged to 'one plus one is ${1+1}'